package org.enwey.icarenew.Component;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.handmark.pulltorefresh.library.PullToRefreshListView;

import org.enwey.icarenew.Model.Comment;
import org.enwey.icarenew.R;

/**
 * Created by John on 3/17/2015.
 */
public class CommentItem extends LinearLayout {
    private TextView mNick;
    private TextView mDate;
    private TextView mComment;

    public CommentItem(Context context) {
        super(context);
        initView();
    }

    public CommentItem(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
    }

    private void initView() {
        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.item_comment,this);
        findViews(view);
    }

    private void findViews(View view) {
        mNick = (TextView) view.findViewById(R.id.item_comment_nick);
        mDate = (TextView) view.findViewById(R.id.item_comment_date);
        mComment = (TextView) view.findViewById(R.id.item_comment_comment);
    }

    public void setData(Comment comment) {
        if (comment != null) {
            mNick.setText(comment.nick);
            mDate.setText(comment.date);
            mComment.setText(comment.content);
        }
    }
}
